<style scoped>
.confirm-modal {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: rgba(0, 0, 0, 0.5);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 9999;
}

.confirm-content {
  width: 80%;
  max-width: 300px;
  background: #fff;
  border-radius: 8px;
  padding: 20px;
  text-align: center;
}

.confirm-title {
  margin-bottom: 10px;
  font-size: 18px;
  font-weight: bold;
}

.confirm-desc {
  margin-bottom: 20px;
  color: #666;
}

.confirm-buttons {
  display: flex;
  justify-content: space-around;
}

.confirm-buttons button {
  padding: 8px 20px;
  border: none;
  border-radius: 4px;
  cursor: pointer;
}

.confirm-buttons button:first-child {
  background: #f5f5f5;
  color: #333;
}

.confirm-buttons button:last-child {
  background: #ff4d4f;
  color: #fff;
}
</style>
<template>
  t
  <div class="confirm-modal" v-if="visible">
    <div class="confirm-content">
      <h3 class="confirm-title">{{ title }}</h3>
      <p class="confirm-desc">{{ content }}</p>
      <div class="confirm-buttons">
        <button @click="handleCancel">取消</button>
        <button @click="handleConfirm">确定</button>
      </div>
    </div>
  </div>
</template>

<script setup>
import { ref, defineProps, defineEmits } from 'vue';

const props = defineProps({
  title: { type: String, default: '确认操作' },
  content: { type: String, default: '是否确认执行该操作？' },
  visible: { type: Boolean, default: false }
});

const emit = defineEmits(['cancel', 'confirm']);

const handleCancel = () => {
  emit('cancel');
};

const handleConfirm = () => {
  emit('confirm');
};
</script>